# _*_ coding: UTF-8 _*_
# @Time     : 2022/4/22 9:53
# @Author   : Li Jie
# @Site     : http://www.cdtest.cn/
# @File     : 下拉菜单操作.py
# @Software : PyCharm

from selenium import webdriver
import time
from selenium.webdriver.common.by import By


def foo1():
    """
    单选框radiodbox和复选框checkbox的选择直接点击，注意一下点击范围
    :return:
    """
    driver = webdriver.Chrome()

    driver.maximize_window()

    driver.get(r"D:\pyworkspace\t79\selenium3\example.html")

    is_selected = driver.find_element(By.ID, "web").is_selected()  # 判断元素是否被选中
    print(is_selected)

    driver.find_element(By.ID, "web").click()  # 勾选复选框

    is_selected = driver.find_element(By.ID, "web").is_selected()  # 判断元素是否被选中
    print(is_selected)

    time.sleep(2)

    driver.quit()


if __name__ == "__main__":
    foo1()
